package cn.itsource.ymjs.service.impl;

import cn.itsource.ymjs.entity.CourseDetail;
import cn.itsource.ymjs.entity.CourseType;
import cn.itsource.ymjs.entity.FitnessCourse;
import cn.itsource.ymjs.query.CourseQuery;
import cn.itsource.ymjs.repository.CourseDetailRepository;
import cn.itsource.ymjs.service.ICourseDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author SuperJellyfish
 * @description TODO
 * @date 2022/2/3 17:58
 */
@Transactional(rollbackFor = Exception.class)
@Service
public class CourseDetailServiceImpl extends BaseServiceImpl<CourseDetail, CourseQuery>  implements ICourseDetailService {
    @Autowired
    private CourseDetailRepository courseDetailRepository;
    @Override
    public void save(FitnessCourse fitnessCourse) {
        // 详情的id不是自增所以获取到课程id作为详情id添加
        CourseDetail courseDetail;
        courseDetail = fitnessCourse.getCourseDetail();
        courseDetail.setId(fitnessCourse.getId());
        courseDetailRepository.save(courseDetail);
    }
}
